package com.flyme.module.exam.provider.service.impl;


import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.exam.client.entity.Exam;
import com.flyme.module.exam.client.entity.ExamRecordDetails;
import com.flyme.module.exam.provider.mapper.ExamRecordDetailsMapper;
import com.flyme.module.exam.provider.service.ExamRecordDetailsService;
import org.springframework.stereotype.Service;

/**
 * @author: flyme
 * @date: 2018/3/7 15:27
 * @desc: 答题明细管理接口实现
 */
@Service
public class ExamRecordDetailsServiceImpl extends BaseServiceImpl<ExamRecordDetailsMapper, ExamRecordDetails> implements ExamRecordDetailsService {

    @Override
    public Integer countFrequency(Exam exam, Integer type){
        if(type.equals(1)){
            return count(q().eq("examId", exam.getId()).eq("examIdStamp", exam.getExamIdStamp()).eq("isTrue", 1));
        }
        return count(q().eq("examId", exam.getId()).eq("examIdStamp", exam.getExamIdStamp()));
    }


}
